package Controller.Singer;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import Bean.SboardBean;
import Dao.SingerDao;

public class singerBoardUpdateformController implements Controller {
	private SingerDao dao;

	public void setDao(SingerDao dao) {
		this.dao = dao;
	}

	@Override
	public ModelAndView handleRequest(HttpServletRequest req,
			HttpServletResponse arg1) throws Exception {
		Integer s_no = Integer.parseInt(req.getParameter("s_no"));
		Integer sb_no = Integer.parseInt(req.getParameter("sb_no"));

		System.out.println("게시판 업데이트 컨트롤러에 들어온 가수 시퀀스값 : " + s_no);
		System.out.println("게시판 업데이트 컨트롤러에 들어온 보드 시퀀스값 : " + sb_no);

		SboardBean sboard = dao.UpdateForm(sb_no);

		System.out.println("게시내용" + sboard.getSb_context());
		System.out.println("게시제목" + sboard.getSb_title());
		System.out.println("게시자" + sboard.getSb_m_id());

		System.out.println("다오 실행 성공!!");
		ModelAndView mav = new ModelAndView();
		mav.setViewName("sboardUpdateForm");
		mav.addObject("sboard", sboard);
		mav.addObject("s_no", s_no);
		System.out.println("sboardUpdateForm 파일로 넘어간다.");
		return mav;
	}

}
